/*
 * AntClustering.h
 *
 *  Created on: Oct 26, 2011
 *      Author: andrey e clayson
 */

#ifndef ANTCLUSTERING_H_
#define ANTCLUSTERING_H_

#include <iostream>
#include <cstdlib>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include "Data.h"

using namespace std;


typedef struct{
	bool searching;
	}Behavior;

class AntClustering {
private:
	Point myposition;
	int mymemory_length,neighborhood_size,ID,no_pick_time;
	stack<Point> mymemory;
	Behavior mybehavior;
	Data cacunda;
	Point *myneighborhood;
	double constante_k1,constante_k2,alfa;

public:
	AntClustering();
	void Walk(int **datagrid,int **workspace,Point dim_datagrid,Data *nDspace,int num_amostras);
	void go_jumping_data(int **datagrid,int **workspace,Point dim_datagrid,Data *nDspace,int num_amostras);
	void go_jumping_free_space(int **datagrid,int **workspace,Point dim_datagrid,Data *nDspace,int num_amostras);
	void go_my_memory_places(int **datagrid,int **workspace,Point dim_datagrid,Data *nDspace,int num_amostras);
	void Pick(Data *nDspace,int num_amostras,int **datagrid,Point dim_grid);
	void Drop(Data *nDspace,int num_amostras,int **datagrid,Point dim_grid);


	void set_position(Point p);
	Point get_position(void);
	void set_behavior(Behavior b);
	Behavior get_behavior(void);
	void set_memorylength(int m);
	int get_memorylength(void);
	void set_neighborhood_size(int s);
	int get_neighborhood_size(void);
	void initialize_neighborhood(void);
	void build_neighborhood(void);
	Point *get_neighborhood(void);
	void set_ID(int id);
	int get_ID(void);
	void set_constant_k1_k2(double k1,double k2);
	double get_constant_k1(void);
	double get_constant_k2(void);
	void set_alfa(double a);
	double get_alfa(void);
	bool check_data_neighborhood(int **grid);
	int count_data_in_neighborhood(int **grid,Point dim_grid);
	void print_neighborhood_positions(int **grid);
	bool check_data_grid(int **grid,Point position);
	bool check_colision(int x, int y,int **workspace,Point dim_workspace);
	bool is_in(int x,int y,Point dim_grid);

	bool distance_type;
	double cosine_similarity(double *v1,double *v2,int length);
	double euclidian_distance(double*v1,double*v2,int num_features);
	double max_distancia_euclidiana;
	double similaridade_media(double **samples,double *amostra_principal,int num_samples,int num_features);
	double *max_min_normalization(double *vet,int length);

	void debugador(string s);
	void debugador(void);

	virtual ~AntClustering();
};

#endif /* ANTCLUSTERING_H_ */
